#!/bin/bash

sum=0

add ()
{
	sum=$[$1 + $2]
}
sub ()
{
	sum=$[$1 - $2]
}
mul ()
{
	sum=$[$1 * $2]
}
div ()
{
	sum=$[$1 / $2]
}

read -p "请输入第一个参数:" num_1
read -p "请输入操作符:" com
read -p "请输入第二个参数:" num_2

case $com in
	'+')
		add $num_1 $num_2
		echo "+"
		;;
	
	'-')
		sub $num_1 $num_2
		echo "-"
		;;
	'*')
		mul $num_1 $num_2
		echo "*"
		;;
	'/')
		div $num_1 $num_2
		echo "/"
		;;
	*)
		echo '语法错误'
		;;
esac

echo "和为:$sum"
